home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Tele / Pete Johnson / AreaTrix 1.0.4<source>.sit / ConfigDialog.p < prev    next >
Encoding:
Text File  |  1990-03-27  |  6.8 KB  |  255 lines  |  [TEXT/PJMM]

  1. unit ConfigDialog;
  2.  
  3. interface
  4.  
  5.  
  6. uses
  7.     Globals, HelloTabby, NewFileUtils;
  8.  
  9. procedure HandleDialog (TheVers: str255);
  10.  
  11.  
  12. implementation
  13.  
  14. { ------------------------------------------------------ }
  15.  
  16. procedure HandleDialog;
  17.  
  18.     var
  19.         ForwardName, FREQName, AgentName, OptionStr: str255;
  20.         ItemHit, itemType: integer;
  21.         dispRect: Rect;
  22.         itemHandle: Handle;
  23.         thisButton: ControlHandle;
  24.         DialogPointer: DialogPtr;
  25.  
  26.     begin
  27.         InitCursor;
  28.         DialogPointer := GetNewDialog(1002, nil, POINTER(-1));                {IM I-413}
  29.         SetPort(DialogPointer);
  30.         FrameDItem(DialogPointer, Ok);
  31.         DrawDialog(DialogPointer);
  32.  
  33.         NextLaunch := GetString(500)^^;        {    Get next launch string from resource    }
  34.         getDItem(DialogPointer, 3, itemType, itemHandle, dispRect);
  35.         SetIText(Handle(itemHandle), NextLaunch);
  36.  
  37.         OptionStr := GetString(501)^^;
  38.         uprString(OptionStr, false);
  39.  
  40.         ForwardName := GetString(502)^^;        {    Get file forward string from resource    }
  41.         getDItem(DialogPointer, 10, itemType, itemHandle, dispRect);
  42.         SetIText(Handle(itemHandle), ForwardName);
  43.  
  44.         FREQName := GetString(503)^^;
  45.         getDItem(DialogPointer, 19, itemType, itemHandle, dispRect);
  46.         SetIText(Handle(itemHandle), FREQName);
  47.  
  48.         AgentName := GetString(504)^^;
  49.         getDItem(DialogPointer, 20, itemType, itemHandle, dispRect);
  50.         SetIText(Handle(itemHandle), AgentName);
  51.  
  52.         TextFont(Geneva);
  53.         TextSize(9);
  54.         ForeColor(redColor);
  55.         getDItem(DialogPointer, 4, itemType, itemHandle, dispRect);
  56.         SetIText(Handle(itemHandle), TheVers);
  57.  
  58.         ForeColor(blackColor);
  59.         SetDAFont(0);
  60.         TextFont(0);
  61.         TextSize(0);
  62.  
  63.         getDItem(DialogPointer, 5, itemType, itemHandle, dispRect);    {    Message to Sysop    }
  64.         thisButton := ControlHandle(itemHandle);
  65.         if (OptionStr[1] = 'Y') then
  66.             SetCtlValue(thisButton, 1)
  67.         else
  68.             SetCtlValue(thisButton, 0);
  69.  
  70.         getDItem(DialogPointer, 6, itemType, itemHandle, dispRect);    {    No Password for list    }
  71.         thisButton := ControlHandle(itemHandle);
  72.         if (OptionStr[2] = 'Y') then
  73.             SetCtlValue(thisButton, 1)
  74.         else
  75.             SetCtlValue(thisButton, 0);
  76.  
  77.         getDItem(DialogPointer, 7, itemType, itemHandle, dispRect);    {    Write to Tabby Log    }
  78.         thisButton := ControlHandle(itemHandle);
  79.         if (OptionStr[3] = 'Y') then
  80.             SetCtlValue(thisButton, 1)
  81.         else
  82.             SetCtlValue(thisButton, 0);
  83.  
  84.         getDItem(DialogPointer, 8, itemType, itemHandle, dispRect);    {    Write to Forward Log    }
  85.         thisButton := ControlHandle(itemHandle);
  86.         if (OptionStr[4] = 'Y') then
  87.             SetCtlValue(thisButton, 1)
  88.         else
  89.             SetCtlValue(thisButton, 0);
  90.  
  91.         getDItem(DialogPointer, 9, itemType, itemHandle, dispRect);    {    Delete Forwarded Files    }
  92.         thisButton := ControlHandle(itemHandle);
  93.         if (OptionStr[5] = 'Y') then
  94.             SetCtlValue(thisButton, 1)
  95.         else
  96.             SetCtlValue(thisButton, 0);
  97.  
  98.         getDItem(DialogPointer, 21, itemType, itemHandle, dispRect);    {    Write to FREQ Log    }
  99.         thisButton := ControlHandle(itemHandle);
  100.         if (OptionStr[6] = 'Y') then
  101.             SetCtlValue(thisButton, 1)
  102.         else
  103.             SetCtlValue(thisButton, 0);
  104.  
  105.         if StillDown then
  106.             repeat
  107.             until not Button;
  108.  
  109.         repeat
  110.             ModalDialog(nil, ItemHit);
  111.  
  112.             case ItemHit of
  113.  
  114.                 1: { OK button hit -- save resources }
  115.                     begin
  116.                         getDItem(DialogPointer, 3, itemType, itemHandle, dispRect);
  117.                         GetIText(Handle(itemHandle), NextLaunch);
  118.                         RmveResource(GetResource('STR ', 500));
  119.                         UpdateResFile(CurrentResFile);
  120.                         AddResource(Handle(NewString(NextLaunch)), 'STR ', 500, 'Next Launch');
  121.  
  122.         {    format of OptionStr is: MsgToSysop, ListOK, TabbyLog    }
  123.  
  124.                         RmveResource(GetResource('STR ', 501));
  125.                         UpdateResFile(CurrentResFile);
  126.                         AddResource(Handle(NewString(OptionStr)), 'STR ', 501, 'Options');
  127.  
  128.                         getDItem(DialogPointer, 10, itemType, itemHandle, dispRect);
  129.                         GetIText(Handle(itemHandle), ForwardName);
  130.                         RmveResource(GetResource('STR ', 502));
  131.                         UpdateResFile(CurrentResFile);
  132.                         AddResource(Handle(NewString(ForwardName)), 'STR ', 502, 'File Forward Name');
  133.  
  134.                         getDItem(DialogPointer, 19, itemType, itemHandle, dispRect);
  135.                         GetIText(Handle(itemHandle), FREQName);
  136.                         RmveResource(GetResource('STR ', 503));
  137.                         UpdateResFile(CurrentResFile);
  138.                         AddResource(Handle(NewString(FREQName)), 'STR ', 503, 'FREQ Name');
  139.  
  140.                         getDItem(DialogPointer, 20, itemType, itemHandle, dispRect);
  141.                         GetIText(Handle(itemHandle), AgentName);
  142.                         RmveResource(GetResource('STR ', 504));
  143.                         UpdateResFile(CurrentResFile);
  144.                         AddResource(Handle(NewString(AgentName)), 'STR ', 504, 'Remote Name');
  145.  
  146.                     end;
  147.  
  148.                 5:    {    Message to Sysop button hit    }
  149.                     begin
  150.                         getDItem(DialogPointer, 5, itemType, itemHandle, dispRect);
  151.                         thisButton := ControlHandle(itemHandle);
  152.                         if OptionStr[1] = 'Y' then
  153.                             begin
  154.                                 OptionStr[1] := 'N';
  155.                                 SetCtlValue(thisButton, 0)
  156.                             end
  157.                         else
  158.                             begin
  159.                                 OptionStr[1] := 'Y';
  160.                                 SetCtlValue(thisButton, 1)
  161.                             end
  162.                     end;
  163.  
  164.                 6:    {    List Without Password button hit    }
  165.                     begin
  166.                         getDItem(DialogPointer, 6, itemType, itemHandle, dispRect);
  167.                         thisButton := ControlHandle(itemHandle);
  168.                         if OptionStr[2] = 'Y' then
  169.                             begin
  170.                                 OptionStr[2] := 'N';
  171.                                 SetCtlValue(thisButton, 0)
  172.                             end
  173.                         else
  174.                             begin
  175.                                 OptionStr[2] := 'Y';
  176.                                 SetCtlValue(thisButton, 1)
  177.                             end
  178.                     end;
  179.  
  180.                 7:    {    Tabby Log button hit    }
  181.                     begin
  182.                         getDItem(DialogPointer, 7, itemType, itemHandle, dispRect);
  183.                         thisButton := ControlHandle(itemHandle);
  184.                         if OptionStr[3] = 'Y' then
  185.                             begin
  186.                                 OptionStr[3] := 'N';
  187.                                 SetCtlValue(thisButton, 0)
  188.                             end
  189.                         else
  190.                             begin
  191.                                 OptionStr[3] := 'Y';
  192.                                 SetCtlValue(thisButton, 1)
  193.                             end
  194.                     end;
  195.  
  196.                 8:    {    Forward Log button hit    }
  197.                     begin
  198.                         getDItem(DialogPointer, 8, itemType, itemHandle, dispRect);
  199.                         thisButton := ControlHandle(itemHandle);
  200.                         if OptionStr[4] = 'Y' then
  201.                             begin
  202.                                 OptionStr[4] := 'N';
  203.                                 SetCtlValue(thisButton, 0);
  204.                             end
  205.                         else
  206.                             begin
  207.                                 OptionStr[4] := 'Y';
  208.                                 SetCtlValue(thisButton, 1)
  209.                             end
  210.                     end;
  211.  
  212.                 9:    {    Delete Forwarded Files button hit    }
  213.                     begin
  214.                         getDItem(DialogPointer, 9, itemType, itemHandle, dispRect);
  215.                         thisButton := ControlHandle(itemHandle);
  216.                         if OptionStr[5] = 'Y' then
  217.                             begin
  218.                                 OptionStr[5] := 'N';
  219.                                 SetCtlValue(thisButton, 0);
  220.                             end
  221.                         else
  222.                             begin
  223.                                 OptionStr[5] := 'Y';
  224.                                 SetCtlValue(thisButton, 1)
  225.                             end
  226.                     end;
  227.  
  228.                 21:    {    Write to FREQ Log button hit    }
  229.                     begin
  230.                         getDItem(DialogPointer, 21, itemType, itemHandle, dispRect);
  231.                         thisButton := ControlHandle(itemHandle);
  232.                         if OptionStr[6] = 'Y' then
  233.                             begin
  234.                                 OptionStr[6] := 'N';
  235.                                 SetCtlValue(thisButton, 0);
  236.                             end
  237.                         else
  238.                             begin
  239.                                 OptionStr[6] := 'Y';
  240.                                 SetCtlValue(thisButton, 1)
  241.                             end
  242.                     end;
  243.  
  244.                 otherwise
  245.                     ;
  246.  
  247.             end;
  248.  
  249.         until (ItemHit = 1) or (ItemHit = 2);
  250.  
  251.         NextLaunch := '';
  252.  
  253.         DisposDialog(DialogPointer)
  254.     end;
  255. end.    {    Unit    }